<template>
    <div class="goods-item" v-if="goods">
        <router-link :to="`/goods/${goods.goods_id}`">
            <el-card class="box-card" shadow="hover">
                <div class="img" v-if="goods">
                    <el-image
                        :src="goods.goods_picture"
                        fit="cover"
                        :lazy="lazy"
                    />
                </div>
                <template v-else>
                    <skeleton
                        width="90px"
                        height="110px"
                        style="margin-left: 0px"
                    ></skeleton>
                </template>
                <div>{{ goods.goods_name }}</div>
                <div style="color: red">{{ goods.goods_price }}元</div>
            </el-card></router-link
        >
    </div>
</template>

<script setup>
defineProps({
    goods: {},
    lazy: {
        default: true,
    },
})
</script>

<style lang="scss" scoped>
.goods-item {
    width: 150px;
    height: 200px;
    cursor: pointer;
    margin-bottom: 15px;
    margin-top: 0px;
    .box-card {
        margin-right: 19px;
        height: 100%;
        text-align: center;
        .img {
            width: 90px;
            height: 120px;
            .el-image {
                height: 100%;
            }
        }
    }
}
</style>
